<script>
    var returLocations = new Array();
<? foreach ( $locations as $key => $location ): ?>

        <?
        foreach ( $location as $loc ):
            if ( $loc->is_return == 1 ):
                ?>
                    returLocations.push('<?= $loc->ID ?>');
                <?
            endif;
        endforeach;
        ?>

    <? endforeach; ?>

</script>
<div class="box-orange <? if ( $method == 'home' ) echo 'top-arrow-box display'; ?>">

    <?
        // title for serch box for different pages
        switch ( $method )
        {
            case $method == 'home':
                ?>
                <h4>RENT A CAR</h4>
                <?
                break;
            case $method == 'available_fleet' OR $method == 'car_details' OR $method == 'browse_fleet':
                ?>
                <h4><?= lang ( 'rentacar.change.detials' ) ?></h4>
                <?
                break;
            case $method == 'browse_car_details':
                ?>
                <h4><?= lang ( 'rentacar.get.car.quote' ) ?></h4>
                <?
                break;
        }
    ?>

    <?
        // Diiferent urls for differnet pages
        if ( $method == 'car_details' || $method == 'browse_car_details' )
        {
            $href = urlify::filter ( $car->name ) . '-' . $car->id;
            $url = 'rentacar/get_car_quote/' . $href;
        }
        else
        {
            $url = 'rentacar/available_fleet';
        }
    ?>


    <form action="<?= base_url ( $url ) ?>" method="post" name="serch_form_rentacar">
        <?
            if ( $method == 'car_details' || $method == 'browse_car_details' )
            {
                ?>
                <input type="hidden" name="browse_car_details" value="1" />
            <? } ?>
        <input type="hidden" name="redirect_checkout" id="redirect_checkout" value="0" />

        <ul class="two-columns clearfix">
            <li class="left">
                <h5><?= lang ( 'rentacar.pickup' ) ?></h5>
                <ul class="side-form">
                    <li>
                        <select class="dropdownized" id="pickup_loc_id" name="pickup_loc_id">

                            <? foreach ( $locations as $key => $location ): ?>
                                    <optgroup label="<?= $key ?>">

                                        <? foreach ( $location as $loc ): ?>
                                            <option value="<?= $loc->ID ?>"><?= $loc->name; ?> <? if ( $loc->price != "0" ) echo " +$loc->price &euro;"; ?></option>
                                        <? endforeach; ?>

                                    </optgroup>
                                <? endforeach; ?>

                        </select>
                    </li>
                    <li>
                        <label><?= lang ( 'rentacar.from' ) ?></label>
                        <input type="text" class="datepicker" id="datefrom">
                    </li>
                    <li>
                        <label><?= lang ( 'rentacar.time' ) ?></label>

                        <? echo makefull ( 'fullfrom', 15, 'id="fullfrom" class="dropdownized"' ); ?>
                    </li>
                </ul>
            </li>
            <li class="right">
                <h5><?= lang ( 'rentacar.return' ) ?></h5>
                <ul class="side-form">
                    <li>
                        <select class="dropdownized" id="return_loc_id" name="return_loc_id">

                            <? foreach ( $locations as $key => $location ): ?>
                                    <optgroup label="<?= $key ?>">

                                        <? foreach ( $location as $loc ): ?>
                                            <option value="<?= $loc->ID ?>"><?= $loc->name; ?> <? if ( $loc->price != "0" ) echo " +$loc->price &euro;"; ?></option>
                                        <? endforeach; ?>

                                    </optgroup>
                                <? endforeach; ?>

                        </select>
                    </li>
                    <li>
                        <label><?= lang ( 'rentacar.to' ) ?></label>
                        <input type="text" class="datepicker" id="dateto">
                    </li>
                    <li>
                        <label><?= lang ( 'rentacar.time' ) ?></label>

                        <? echo makefull ( 'fullto', 15, 'id="fullto" class="dropdownized"' ); ?>

                    </li>
                </ul>
            </li>
        </ul>

        <? if ( isset ( $not_available ) && $not_available != FALSE ): ?>
                <div style="margin-bottom: 15px; color: #FFF;"><?= lang ( 'not.availble.in.this.period' ) ?></div>
            <? endif; ?>        
        <input type="hidden" id="pickup_date" name="pickup_date" value="25.04.2012" />
        <input type="hidden" id="return_date" name="return_date" value="26.04.2012" />

        <?
            // Button title for different pages
            switch ( $method )
            {
                case $method == 'home':
                    $subText = lang ( 'rentacar.show.best.prices' );
                    break;
                case $method == 'available_fleet' OR $method == 'car_details' OR $method == 'browse_fleet':
                    $subText = lang ( 'rentacar.change.detials' );
                    break;
                case $method == 'browse_car_details':
                    $subText = lang ( 'rentacar.get.car.quote' );
            }
        ?>

        <input type="submit" value="<?= $subText ?>" class="form-button button-search">

    </form>

</div><!-- / Form -->